package com.lb.jwitter.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Collections; 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import com.lb.jwitter.util.ApplicationContextProvider; 
import java.util.Map; 
import org.springframework.test.context.ContextConfiguration; 
import com.lb.jwitter.service.TblQuyenChiTietService; 
import com.lb.jwitter.service.TblTaiKhoan; 
import com.opensymphony.xwork2.ActionContext; 
import com.opensymphony.xwork2.Action; 
import com.lb.jwitter.service.ConditionReport; 
import com.lb.jwitter.util.Message; 
import com.lb.jwitter.service.TblQLDTTXALopMonHocDuKien;
import com.lb.jwitter.service.TblQLDTTXALopMonHocDuKienService;

 /** 
 * @author QUOCVIET  
 * 
 */ 


@ContextConfiguration(locations="classpath:beans.xml") 
public class TblQLDTTXAHocKyTrongNamtblQLDTTXALopMonHocDuKienDeleteAction{
    private Message msg; 
    public Message getMsg() { return msg; }

    private int tblQLDTTXALopMonHocDuKienid; 
    public int getTblQLDTTXALopMonHocDuKienid() { return tblQLDTTXALopMonHocDuKienid; }

    public void setTblQLDTTXALopMonHocDuKienid(int tblQLDTTXALopMonHocDuKienid) { this.tblQLDTTXALopMonHocDuKienid = tblQLDTTXALopMonHocDuKienid; }

    private TblQLDTTXALopMonHocDuKienService tblQLDTTXALopMonHocDuKienService; 

	private int preDelete(Message msg, String ids ){ 
        msg.setPreMessage_b(true); 
        msg.setPreMessage_s("success"); 
        return 1; 
    } 
	private int postDelete(Message msg, String ids ){ 
        msg.setPostMessage_b(true); 
        msg.setPostMessage_s("success"); 
        return 1; 
    } 
  private TblTaiKhoan taiKhoanDangNhap; 
 public TblTaiKhoan getTaiKhoanDangNhap() { 
     return taiKhoanDangNhap; 
 } 
 public void setTaiKhoanDangNhap(TblTaiKhoan taiKhoanDangNhap) { 
     this.taiKhoanDangNhap = taiKhoanDangNhap; 
 } 
 private TblQuyenChiTietService tblQuyenChiTietService;
	 @Autowired // Injected by Spring 
     ApplicationContextProvider contextProvider; 
    public String execute() throws Exception 
   { 
        try{ 
     Map session = ActionContext.getContext().getSession();
     taiKhoanDangNhap =  (TblTaiKhoan) session.get("taiKhoan");
     if( taiKhoanDangNhap == null) return "noprivilege";
    ApplicationContext context = ApplicationContextProvider.getApplicationContext(); 
    tblQuyenChiTietService = (TblQuyenChiTietService) context.getBean("tbl_Quyen_ChiTietClient"); 
    if(!tblQuyenChiTietService.checkRight(taiKhoanDangNhap.getMaNhomQuyen().getId(), "tbl_QLDTTXA_LopMonHoc_DuKien", "xoa")){ 
        return "noprivilege"; 
        } 
 tblQLDTTXALopMonHocDuKienService = (TblQLDTTXALopMonHocDuKienService) context.getBean("tbl_QLDTTXA_LopMonHoc_DuKienClient"); 
     msg = new Message(); 

    tblQLDTTXALopMonHocDuKienService.deletetblQLDTTXALopMonHocDuKien( new Long(tblQLDTTXALopMonHocDuKienid)); 
        return Action.SUCCESS; 
      } 
      catch(Exception e){ 
      System.out.println("Loi Delete tbl_QLDTTXA_LopMonHoc_DuKien Action"); 
     e.printStackTrace(); 
    return Action.ERROR; 
 } 
 } 
 } 
 
